package cn.exrick.xboot.base.entity

import cn.exrick.xboot.core.base.XbootBaseEntityKt
import cn.exrick.xboot.core.common.utils.SnowFlakeUtil
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import com.fasterxml.jackson.annotation.JsonFormat
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import org.hibernate.annotations.DynamicInsert
import org.hibernate.annotations.DynamicUpdate
import org.springframework.format.annotation.DateTimeFormat
import java.util.*
import javax.persistence.*

/**
 * @author Fei
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "se_break_roles_record")
@TableName("se_break_roles_record")
@ApiModel(value = "违章记录")
data class BreakRolesRecord(

        @ApiModelProperty("企业用户id")
        var enterpriseUserId: String? = null,

        @ApiModelProperty("员工id")
        var employeeId: String? = null,

        @ApiModelProperty("违章时间")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        var breakRoleTime: Date? = null,

        @ApiModelProperty("违章时间str类型")
        @Transient
        @TableField(exist = false)
        var breakRoleTimeStr: String? = null,

        @ApiModelProperty("违章内容")
        @Column(length = 1000)
        var breakRoleContent: String? = null,

        @ApiModelProperty("违章依据")
        @Column(length = 1000)
        var breakRoleAccording: String? = null,

        @ApiModelProperty("违章图片")
        var breakRolePics: String? = null


): XbootBaseEntityKt() {

    @Id
    @TableId
    override var id: String = SnowFlakeUtil.nextId().toString()

    companion object {
        private const val serialVersionUID = 1L
    }
}